// 	Name: 03.c
//	Description: Chapter 5 project 3
//	Author: StableGenius
//	Date: 2020-05-07
//	Email: feng@dongfa.pro

#include <stdio.h>

int main(void){
	int stock_num;
	float commission, stock_price, value, rival;
	
	printf("Enter stock number: ");
	scanf("%d", &stock_num);
	
	printf("Enter stock price: ");
	scanf("%f", &stock_price);
	
	value = stock_num * stock_price;
	
	if (value < 2500.00f)
        commission = 30.00f + .017f * value;
    else if (value < 6250.00f)
        commission = 56.00f + .0066f * value;
    else if (value < 20000.00f)
        commission = 76.00f + .0034f * value;
    else if (value < 50000.00f)
        commission = 100.00f + .0022f * value;
    else if (value < 500000.00f) 
        commission = 155.00f + .0011f * value;
    else
        commission = 255.00f + .0009f * value;

    if (commission < 39.00f)
        commission = 39.00f;

    printf("Commission: $%.2f\n", commission);

    if (stock_num < 2000)
        rival = 33.00f + .03f * stock_num;
    else 
        rival = 33.00f + .02f * stock_num;

    printf("Rival comission: $%.2f\n", rival);

	return 0;
}
